package com.woniu.service.impl;

import com.woniu.model.EArtical;
import com.woniu.dao.EArticalMapper;
import com.woniu.service.IEArticalService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 文章表 服务实现类
 * </p>
 *
 * @author Kevin Kwok
 * @since 2021-04-16
 */
@Service
@Transactional
public class EArticalServiceImpl extends ServiceImpl<EArticalMapper, EArtical> implements IEArticalService {
    @Resource
    private EArticalMapper articalMapper;

    @Override
    public int addNewArtical(String title, String content,Integer typeId) {
        int i = articalMapper.addNewArtical(title, content, typeId);
        return i;
    }

    @Override
    public int editNewArtical(String title, String content, Integer typeId, Integer id) {
        int i = articalMapper.editNewArtical(title, content, typeId, id);
        return i;
    }

    @Override
    public int deleteArtical(Integer id) {
        int i = articalMapper.deleteArtical(id);
        return i;
    }

    @Override
    public List<EArtical> queryAll() {
        List<EArtical> eArticals = articalMapper.queryAll();
        return eArticals;
    }
}
